<?php

class Users extends \Phalcon\Mvc\Model
{

    /**
     *
     * @var integer
     */
    public $id;

    /**
     *
     * @var string
     */
    public $app_id;

    /**
     *
     * @var string
     */
    public $open_id;

    /**
     *
     * @var string
     */
    public $subscribe_time;

    /**
     *
     * @var string
     */
    public $active_time;

    /**
     *
     * @var integer
     */
    public $is_subscribe;

    /**
     *
     * @var string
     */
    public $gmt_created;

    /**
     *
     * @var string
     */
    public $gmt_updated;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSource("users");
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'users';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return Users[]|Users|\Phalcon\Mvc\Model\ResultSetInterface
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return Users|\Phalcon\Mvc\Model\ResultInterface
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    public function beforeSave(){
//        $this->subscribe_time=date("Y-m-d H:i:s",$this->subscribe_time);
        $this->gmt_created=date("Y-m-d H:i:s");
    }

}
